package org.eclipse.swt.snippets;

public class ClassFilter implements Filter {

    private String clazz;

    public ClassFilter(String clazz) {
        this.clazz = clazz;
    }

    @Override
    public boolean filter(Message msg) {
        return clazz.equals(msg.getClazz());
    }

    @Override
    public int hashCode() {
        int hashCode = clazz.hashCode();
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof ClassFilter) {
            ClassFilter f = (ClassFilter) obj;
            return clazz == f.clazz;
        }
        return false;
    }

    @Override
    public String toString() {
        return clazz;
    }
}
